home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / bind493a.zip / named / db_reload.c < prev    next >
C/C++ Source or Header  |  1994-12-15  |  4KB  |  126 lines

  1. #if !defined(lint) && !defined(SABER)
  2. static char sccsid[] = "@(#)db_reload.c    4.22 (Berkeley) 3/21/91";
  3. static char rcsid[] = "$Id: db_reload.c,v 8.1 1994/12/15 06:24:14 vixie Exp $";
  4. #endif /* not lint */
  5.  
  6. /*
  7.  * ++Copyright++ 1986, 1988
  8.  * -
  9.  * Copyright (c) 1986, 1988
  10.  *    The Regents of the University of California.  All rights reserved.
  11.  * 
  12.  * Redistribution and use in source and binary forms, with or without
  13.  * modification, are permitted provided that the following conditions
  14.  * are met:
  15.  * 1. Redistributions of source code must retain the above copyright
  16.  *    notice, this list of conditions and the following disclaimer.
  17.  * 2. Redistributions in binary form must reproduce the above copyright
  18.  *    notice, this list of conditions and the following disclaimer in the
  19.  *    documentation and/or other materials provided with the distribution.
  20.  * 3. All advertising materials mentioning features or use of this software
  21.  *    must display the following acknowledgement:
  22.  *     This product includes software developed by the University of
  23.  *     California, Berkeley and its contributors.
  24.  * 4. Neither the name of the University nor the names of its contributors
  25.  *    may be used to endorse or promote products derived from this software
  26.  *    without specific prior written permission.
  27.  * 
  28.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  29.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  30.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  31.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  32.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  34.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  37.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  38.  * SUCH DAMAGE.
  39.  * -
  40.  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
  41.  * 
  42.  * Permission to use, copy, modify, and distribute this software for any
  43.  * purpose with or without fee is hereby granted, provided that the above
  44.  * copyright notice and this permission notice appear in all copies, and that
  45.  * the name of Digital Equipment Corporation not be used in advertising or
  46.  * publicity pertaining to distribution of the document or software without
  47.  * specific, written prior permission.
  48.  * 
  49.  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
  50.  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
  51.  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
  52.  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  53.  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  54.  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  55.  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  56.  * SOFTWARE.
  57.  * -
  58.  * --Copyright--
  59.  */
  60.  
  61. #include <sys/param.h>
  62. #include <sys/socket.h>
  63. #include <netinet/in.h>
  64. #include <arpa/nameser.h>
  65. #include <stdio.h>
  66. #include <syslog.h>
  67.  
  68. #include "named.h"
  69.  
  70. /*
  71.  * Flush and reload data base.
  72.  */
  73. void
  74. db_reload()
  75. {
  76.     dprintf(3, (ddt, "reload()\n"));
  77.     syslog(LOG_NOTICE, "reloading nameserver\n");
  78.  
  79.     qflush();
  80.     sqflush(NULL);
  81.     getnetconf();
  82. #ifdef FORCED_RELOAD
  83.     reloading = 1;     /* to force transfer if secondary and backing up */
  84. #endif
  85.     ns_init(bootfile);
  86.     time(&resettime);
  87. #ifdef FORCED_RELOAD
  88.     reloading = 0;
  89.     if (!needmaint)
  90.         sched_maint();
  91. #endif /* FORCED_RELOAD */
  92.  
  93.     dprintf(1, (ddt, "Ready to answer queries.\n"));
  94.     syslog(LOG_NOTICE, "Ready to answer queries.\n");
  95. }
  96.  
  97. #if 0
  98. /* someday we'll need this.. (untested since before 1990) */
  99. void
  100. db_free(htp)
  101.     struct hashbuf *htp;
  102. {
  103.     register struct databuf *dp, *nextdp;
  104.     register struct namebuf *np, *nextnp;
  105.     struct namebuf **npp, **nppend;
  106.  
  107.     npp = htp->h_tab;
  108.     nppend = npp + htp->h_size;
  109.     while (npp < nppend) {
  110.         for (np = *npp++; np != NULL; np = nextnp) {
  111.         if (np->n_hash != NULL)
  112.             db_free(np->n_hash);
  113.         (void) free((char *)np->n_dname);
  114.         for (dp = np->n_data; dp != NULL; ) {
  115.             nextdp = dp->d_next;
  116.             (void) free((char *)dp);
  117.             dp = nextdp;
  118.         }
  119.         nextnp = np->n_next;
  120.         free((char *)np);
  121.         }
  122.     }
  123.     (void) free((char *)htp);
  124. }
  125. #endif
  126.